package weather;

import java.util.ArrayList;

public class Central implements IResponse {

	private ArrayList<Station> stations;

	public Central() {
		this.stations = new ArrayList<Station>();
	}
	
	public void addStation(String location) {
		this.stations.add(new Station(location, this));
	}
	
	public synchronized void measurementEvent() {
		for (IRequest station: this.stations) {
			station.measure();
		}
	}
	
	public void answer(Weather payload) {
		System.out.println(payload.toString());
	}
}